Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit 939bc37f8632fad13ad661c0be6325c4b64fc3d1


Parents : 14eb35f
Author : Mark Qvist <mark@unsigned.io>
Date : 2021-10-15T13:13:48+02:00

Mitigate KeyError in urwid

Changes

2 files changed, 6 insertions(+), 3 deletions(-)


Diff

diff --git a/nomadnet/ui/textui/Main.py b/nomadnet/ui/textui/Main.py
index 5fb1228..deca22a 100644
--- a/nomadnet/ui/textui/Main.py
+++ b/nomadnet/ui/textui/Main.py
@@ -129,11 +129,12 @@ class MainDisplay():
def update_active_shortcuts(self):
self.frame.contents["footer"] = (self.sub_displays.active().shortcuts().widget, None)
- def request_redraw(self):
- self.app.ui.loop.set_alarm_in(0.25, self.redraw_now)
+ def request_redraw(self, extra_delay=0.0):
+ self.app.ui.loop.set_alarm_in(0.25+extra_delay, self.redraw_now)
def redraw_now(self, sender=None, data=None):
- self.app.ui.loop.draw_screen()
+ self.app.ui.loop.screen.clear()
+ #self.app.ui.loop.draw_screen()
def start(self):
self.menu_display.start()

diff --git a/nomadnet/ui/textui/Network.py b/nomadnet/ui/textui/Network.py
index 6348611..c47d5c1 100644
--- a/nomadnet/ui/textui/Network.py
+++ b/nomadnet/ui/textui/Network.py
@@ -107,6 +107,7 @@ class AnnounceInfo(urwid.WidgetWrap):
self.parent.left_pile.contents[0] = (self.parent.announce_stream_display, options)
def connect(sender):
+ self.app.ui.main_display.request_redraw(extra_delay=0.75)
self.parent.browser.retrieve_url(RNS.hexrep(source_hash, delimit=False))
show_announce_stream(None)
@@ -433,6 +434,7 @@ class KnownNodeInfo(urwid.WidgetWrap):
self.parent.left_pile.contents[0] = (self.parent.known_nodes_display, options)
def connect(sender):
+ self.app.ui.main_display.request_redraw(extra_delay=0.75)
self.parent.browser.retrieve_url(RNS.hexrep(source_hash, delimit=False))
show_known_nodes(None)


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────